* TScanCDEV::DoUpdate() contains a hard-coded literal string; it should be stored as a resource
*/
#ifndef __USCANCDEV__
#define __USCANCDEV__
#ifndef __FILES__
#include <Files.h>
#endif
#ifndef __UCONTROLPANEL__
#include <UControlPanel.h>
#endif
class TScanCDEV: public TControlPanel {
public:
TScanCDEV(DialogPtr, short numItems);
void DoHit(short, EventRecord *, long *cdevValue); // override
void DoUpdate(long *cdevValue); // override
protected:
virtual void DoDirectory(const CInfoPBRec &); // called once for each subdirectory entry in the catalog
virtual void DoFile(const CInfoPBRec &); // called once for each file entry in the catalog
virtual void ScanVolume(); // scans the startup volume
virtual void ShowStatus(ConstStr255Param);
private:
void ScanDirectory(long); // scans the given directory; calls itself recursively to scan subvolumes
private:
CInfoPBRec fCatalogInfo; // used by ScanVolume() and ScanDirectory() as the parameter block for file system calls; this could be declared static, since we are guaranteed no more than one instantiation at a time
Str31 fDirEntryName; // what fCatalogInfo.hFileInfo.ioNamePtr will point to; this could be declared static, since we are guaranteed no more than one instantiation at a time
static const Rect kDirectoryRect; // where in the control panel we draw the subdirectory’s name
static const Rect kFileRect; // where we draw the file’s name
static const Rect kStatusRect; // where we draw our status information
};
void TextBox(const Rect &, ConstStr255Param, short just = teJustLeft); // overload (this is here because this is example code; it should be in a library)